home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / freetab.fpl < prev    next >
Text File  |  1996-04-17  |  1KB  |  75 lines

  1. /******************************
  2.  * Read FreeTab.FPL.README!   *
  3.  * Written by Daniel Stenberg *
  4.  ******************************/
  5. int tabs[20];
  6. int numtabs=0;
  7. int sizetabs=20;
  8.  
  9. export int FreeTabGo()
  10. {
  11.   int now = GetCursor();
  12.   int a=0;
  13.   int go=0;
  14.  
  15.   while(a<numtabs) {
  16.     if(tabs[a]>now) {
  17.       go = tabs[a]-now;
  18.       while(go--)
  19.         Output(" ");
  20.       break;
  21.     }
  22.     a++;
  23.   }
  24. }
  25.  
  26. export int FreeTabSet()
  27. {
  28.   int now = GetCursor();
  29.   int to=0;
  30.   int from=0;
  31.   int newtab[sizetabs];
  32.   string view;
  33.  
  34.   ReturnStatus(joinstr("Tab stop set at column ", itoa(now)));
  35.  
  36.   while(to<numtabs) {
  37.     if(tabs[from]>now) {
  38.       newtab[to++] = now;
  39.       numtabs++;
  40.       now=9999;
  41.     } else {
  42.       newtab[to] = tabs[from];
  43.       to++;
  44.       from++;
  45.     }
  46.   }
  47.  
  48.   if(9999 != now) {
  49.     newtab[to]=now;
  50.     numtabs++;
  51.   }
  52.   for(to=0; to<numtabs; to++) {
  53.     tabs[to] = newtab[to];
  54.     view += joinstr(itoa(tabs[to]), " ");
  55.   }
  56. }
  57.  
  58. export int FreeTabDisp()
  59. {
  60.   string view;
  61.   int a;
  62.   for(a=0; a<numtabs; a++) {
  63.     view += joinstr(itoa(tabs[a]), " ");
  64.   }
  65.   if(strlen(view))
  66.     Request(joinstr("There are tab stops at column:\n", view), "", "OK");
  67.   else
  68.     Request("No tab stops entered!", "", "OK");
  69. }
  70.  
  71. ConstructInfo("freetab", "", "", "LB(display)", "", 0, 1); /* default is disabled */
  72. AssignKey("FreeTabSet();", "shift 'tab'");
  73. AssignKey("FreeTabGo();", "'tab'", "freetab");
  74. AssignKey("FreeTabDisp();", "amiga 'tab'", "freetab");
  75.